﻿//双击事件
function CustomDbClick() {
    parent.closeWin(); //去掉双击功能
}

//查看明细
var fnLinkItem = function (elCell, oRecord, oColumn, sData) {
    //debugger;
    elCell.innerHTML = "<a href=\"#\" onclick=\"javascript:fnOpenItem('" + oRecord.getData("WorkFlowInsId") + "','" + sData + "');\">" + sData + "</a>";
};

//打开链接
var fnOpenItem = function (workFlowInsId, workFlowNo) {
    GetWorkFlowInfo(workFlowNo);
}

//获取流程信息
function GetWorkFlowInfo(workFlowNo) {
    YAHOO.util.Connect.asyncRequest('POST', "../EHR/workTimeAjax.aspx?flag=GetWorkFlowInfo&workFlowNo=" + workFlowNo, {
        success: function (res) {
            try {
                var str = res.responseText.split("|");
                //debugger;
                if (str[0] == "1") {
                    var OperatorInstanceId = str[1];
                    var WorkTaskInstanceId = str[2];
                    var FlowCaptions = str[3];
                    var pagetitle = FlowCaptions;
                    parent._employeeTitle = pagetitle;
                    var url = '"' + "../../Crm/BasePages/WorkTaskCtrlPage.aspx?OperatorInstanceId=" + OperatorInstanceId + "&WorkTaskInstanceId=" + WorkTaskInstanceId + '"';
                    parent.addTabs(pagetitle, encodeURI(url));
                    parent.NeedRefreshPage = this;
                }
                else {
                    alert("获取流程信息失败！");
                }
            }
            catch (e) { }
            finally { }
        },
        failure: function (error) {
            alert("获取流程信息数据错误：" + error.statusText);
        }
    }, null);
}

//导入
function fnImport() {
    document.getElementById("EditUIWindow").src = "../EHR/hrImportBalanceTime.aspx";
    SetDWH(500, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//单元格格式化
var fnFormater = function (elCell, oRecord, oColumn, sData) {
    //debugger;
    //elCell.innerHTML = oRecord.getData("DeptName");
    var cellValue = sData;
    if (cellValue != null && cellValue.length > 20) {
        cellValue = cellValue.substr(0, 20) + "...";
    }
    elCell.innerHTML = "<a href=\"#\" title='" + sData + "'>" + cellValue + "</a>"; ;
}




